﻿	<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>


<h1>Edit | Изменение данных в заявке:</h1>

<form:form action="${action}" commandName="request"
	modelAttribute="request" method="POST">


	<c:if test="${request.requestId > 0}">
		<form:label path="requestId">ID:</form:label>
		<form:hidden path="requestId" /> ${request.requestId} <br />
		<br />
	</c:if>

	<c:if test="${request.requestId == 0}">
		<form:label path="requestId">ID:</form:label>
		<form:input path="requestId" />
		<form:errors path="requestId" />
		<br />
		<br />
	</c:if>

	<br />
	<br />


<%-- 
 	<form:label path="client">Client | Клиент :</form:label>
	<form:input path="client" />
	<form:errors path="client" />
	<br />

    <form:label path="manager">Manager | Обслужвающий менеджер:</form:label>
	<form:input path="manager" />
	<form:errors path="manager" />
	<br /> 

 --%>

<%--

	<form:label path="client">Client | Клиент:</form:label>
	<form:select path="client">
	<form:options items="${clientList}" />
	</form:select>
	<form:errors path="client" cssClass="error" />
     <br />


 	<form:label path="manager">Manager | Обслуживающий менеджер:</form:label>
	<form:select path="manager">
	<form:options items="${managerList}" />
	</form:select>
	<form:errors path="manager" cssClass="error" />
     <br />
--%>

<%--
 	<form:label path="rentedCar">Renterd car | Арендуемый автомобиль:</form:label>
	<form:select path="rentedCar">
	<form:options items="${carList}" />
	</form:select>
	<form:errors path="rentedCar" cssClass="error" />
     <br />
--%>


	<form:label path="client">Client | Клиент:</form:label>
	<form:select path="client" >
	 <%--	<form:option value="NONE" label="--- Select ---" />  --%>
		<c:forEach var="client" items="${clientList}">
			<c:if test="${client.key eq request.client.userId}">
				<option value="${client.key}" selected="selected">${client.value}</option>
			</c:if>
			<c:if test="${client.key ne request.client.userId}">
				<option value="${client.key}">${client.value}</option>
			</c:if>
		</c:forEach>
	</form:select>
	<form:errors path="client" cssClass="error" />
        <br/>


	<form:label path="manager">Manager | Обслуживающий менеджер:</form:label>
	<form:select path="manager" >
	 <%--	<form:option value="NONE" label="--- Select ---" /> --%>
		<c:forEach var="manager" items="${managerList}">
			<c:if test="${manager.key eq request.manager.userId}">
				<option value="${manager.key}" selected="selected">${manager.value}</option>
			</c:if>
			<c:if test="${manager.key ne request.manager.userId}">
				<option value="${manager.key}">${manager.value}</option>
			</c:if>
		</c:forEach>
	</form:select>
	<form:errors path="manager" cssClass="error" />
        <br/>


	<form:label path="rentedCar">Renterd car | Арендуемый автомобиль:</form:label>
	<form:select path="rentedCar" >
<%--		<form:option value="NONE" label="--- Select ---" />      --%>
		<c:forEach var="rentedCar" items="${carList}">
			<c:if test="${rentedCar.key eq request.rentedCar.carId}">
				<option value="${rentedCar.key}" selected="selected">${rentedCar.value}</option>
			</c:if>
			<c:if test="${rentedCar.key ne reqiest.rentedCar.carId}">
				<option value="${rentedCar.key}">${rentedCar.value}</option>
			</c:if>
		</c:forEach>
	</form:select>
	<form:errors path="rentedCar" cssClass="error" />
        <br/>


<%-- 

	<form:label path="dateOfDelivery"> Date of delivery | Дата взятия в аренду:</form:label>
	<form:input path="dateOfDelivery" />
	<form:errors path="dateOfDelivery" />
	<br />

	<form:label path="dateOfReturn"> Date of return | Дата возврата:</form:label>
	<form:input path="dateOfReturn" />
	<form:errors path="dateOfReturn" />
	<br />
 
--%> 

<%--  
	<form:label path="status">Status | Статус заявки:</form:label>
	<form:input path="status" />
	<form:errors path="status" />
	<br />
 --%>  

	<form:label path="status">Status | Статус заявки:</form:label>
	<form:select path="status" >
<%--		<form:option value="NONE" label="--- Select ---" />      --%>
		<c:forEach var="status" items="${statusList}">
			<c:if test="${status.key eq request.status}">
				<option value="${status.key}" selected="selected">${status.value}</option>
			</c:if>
			<c:if test="${status.key ne reqiest.status}">
				<option value="${status.key}">${status.value}</option>
			</c:if>
		</c:forEach>
	</form:select>
	<form:errors path="status" cssClass="error" />
        <br/>



<%--

	<form:label path="status">Status | Статус заявки:</form:label><br/>
	<form:select path="status">
	<form:options items="${statusList}" />
	</form:select>
	<form:errors path="status" cssClass="error" />
        <br />
--%> 

 	<form:label path="priceOfRent"> Price of rent | Стоимость аренды:</form:label>
	<form:input path="priceOfRent" />
	<form:errors path="priceOfRent" />
	<br />

	<form:label path="priceOfRepair"> Price of repair | Стоимость ремонта:</form:label>
	<form:input path="priceOfRepair" />
	<form:errors path="priceOfRepair" />
	<br />


	<form:label path="messageForClient"> Message for client | Сообщение для клиента:</form:label>
	<form:input path="messageForClient" />
	<form:errors path="messageForClient" />
	<br />


	<form:label path="damaged">Is damaged? | Автомобль повреждён? :</form:label>
	<form:checkbox path="damaged" />
	<form:errors path="damaged" cssClass="error" />
        <br />


	<form:label path="paidRented">Is rent paided? | Оплачена ли аренда? :</form:label>
	<form:checkbox path="paidRented" />
	<form:errors path="paidRented" cssClass="error" />
        <br />


	<form:label path="paidRepaired">Is repair paided? | Оплачен ли ремонт?  :</form:label>
	<form:checkbox path="paidRepaired" />
	<form:errors path="paidRepaired" cssClass="error" />
        <br />



	
	<input type="submit" value="Save | Сохранить" />
	<input type="reset" value="Cancel | Отмена" onclick="window.history.back();"/>

</form:form>
